#if NOT_USED_YET
using System;

namespace SharpFastCGI.Internals
{
	/// <summary>
	/// Statistics over a random variable.
	/// </summary>
	/// <remarks>
	/// Decaying is used to make computations faster, and give more weight to recent
	/// observations.
	/// </remarks>
	internal class RandomVariable
	{
		private double mNullWeight;
		private double mMeanValue;
		private double mMeanSquaredValue;
		private double mFactor = 0.05;
		
		public double Mean
		{
			get { return mMeanValue / mNullWeight; }
		}
		
		public double Variance
		{
			get { return (mMeanSquaredValue - mMeanValue * mMeanValue / mNullWeight) / mNullWeight; }
		}
		
		public RandomVariable()
		{
			Reset();
		}
		
		public void Reset()
		{
			mNullWeight = 1.0;
			mMeanValue = mMeanSquaredValue = 0;
		}
		
		public void AddObservation(double Observation)
		{
			double d = 1 - mFactor;
			mNullWeight *= d;
			mMeanValue = d * mMeanValue + mFactor * Observation;
			mMeanSquaredValue = d * mMeanSquaredValue + mFactor * Observation * Observation;
		}
	}
}
#endif